package cn.fzkj.project.user.controller;

import cn.fzkj.common.ResultVO;
import cn.fzkj.project.user.domain.User;
import cn.fzkj.project.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping("test")
    public ResultVO test(){
        List<User> allUsers = userService.findAllUsers();
        return ResultVO.success(allUsers);
    }

    @PreAuthorize("@ss.hasPermi('USER')")
    @RequestMapping("admin")
    public ResultVO admin(){
        List<User> allUsers = userService.findAllUsers();
        return ResultVO.success(allUsers);
    }

}
